package cn.lanchengkeji.datafillingsystem.controller;



import cn.lanchengkeji.datafillingsystem.common.ResponseBean;
import cn.lanchengkeji.datafillingsystem.common.StatusCode;
import cn.lanchengkeji.datafillingsystem.service.IUsersService;
import io.swagger.annotations.Api;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;


/**
 * 上传图片
 */
@RestController
@RequestMapping("/upload-img")
@Api(hidden = false, tags = {"上传图片 前端控制器"})
public class UploadImgController extends BaseController {

    // 日志
    private static Logger logger = LoggerFactory.getLogger(UploadImgController.class);
    @Resource
    private IUsersService iUsersService;

    /**
     *  上传文件
     * @param imageFile
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/upload",method = RequestMethod.POST)
    @RequiresAuthentication
    @RequiresPermissions("uploadImg:upload")
    @Transactional
    public ResponseBean uploadFileAndCreateThumbnail(@RequestParam("file") MultipartFile imageFile, @RequestParam("content") String content, @RequestParam("type") Integer type, HttpServletRequest request)
            throws Exception{



        return new ResponseBean(StatusCode.OK, null);
    }


}
